home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 101-125 / scopedisk114 / fastmenu / fastmenu1.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-19  |  8KB  |  157 lines

  1. /* FastMenu1.rexx                                                       */
  2. /* this opens a window with buttons which run macros                    */
  3. /* Marvin Weinstein, 1989                                               */
  4. /* Modified by Steven D. Kapplin, 1989                                  */
  5. /* Requires RexxArpLib, RexxSupport, and ScreenShare libraries in Libs: */
  6. /* Menuitems and Gadgetitems can have multi-line scripts.  See for an   */
  7. /* example the entry for Calendar which contains a two line script.  A  */
  8. /* similar setup can be done for gadgets as well as for menu items.  I  */
  9. /* have included a second rexx program, PrtSetup.rexx, as an example of */
  10. /* adding gadgets.  FastMenu1.rexx does not use gadgets, so the window  */
  11. /* is made as small as possible so that it fits in the menu bar of the  */
  12. /* Workbench screen, however, you can position the menu anywhere on the */
  13. /* screen by adding the necessary parameters when FastMenu1 is invoked. */
  14. /* See the command syntax by simply executing FastMenu1 ? for a short   */
  15. /* message showing the syntax.  In the event no parameters are supplied */
  16. /* or parameters are missing, default parameters are used.  The defaults*/
  17. /* are xpos=0, ypos=150, width=240, height=10.  The minimum width is    */
  18. /* 240 pixels.  You can customize this menu to include whatever you want*/
  19. /* by adding or deleting or modifying the commands.  Be sure to pay     */
  20. /* close attention to the quoting conventions because they are critical */
  21. /* to having your commands work.  Several libraryies must be present    */
  22. /* for FastMenu1 to work.  Be sure they are in the libs: directory.  If */
  23. /* they are not present or if FastMenu1's port has already been created */
  24. /* FastMenu1 will exit with a short error message.                      */
  25.  
  26. if show('P','FASTHOST') then do
  27.     say 'FASTHOST Port in Use or ARexx Menu Program Running ... Aborting'
  28.     exit 10
  29. end
  30.  
  31. parse arg xpos ypos width height .
  32.  
  33. if xpos = "?" then do
  34.     say "SYNTAX:  FastMenu1 <xpos> <ypos> <wid> <ht>"
  35.     say "    xpos = x offset for window  (default = 0)"
  36.     say "    ypos = y offset for window  (default = 150)"
  37.     say "    wid  = window width (min = 240, default = 240)"
  38.     say "    ht   = window height (min = 10, default = 10)"
  39.     exit 0
  40. end
  41.  
  42. if ~exists('libs:rexxarplib.library') then do
  43.     say 'RexxArpLib.library not in Libs: ... Aborting'
  44.     exit 10
  45. end
  46.  
  47. if ~exists('libs:rexxsupport.library') then do
  48.     say 'RexxSupport.library not in Libs: ... Aborting'
  49.     exit 10
  50. end
  51.  
  52. if ~exists('libs:screenshare.library') then do
  53.     say 'ScreenShare.library not in Libs: ... Aborting'
  54.     exit 10
  55. end
  56.  
  57. if ~show('L','rexxsupport.library') then
  58.    call addlib('rexxsupport.library',0,-30)
  59. if ~show('L','rexxarplib.library') then
  60.    call addlib('rexxarplib.library',0,-30)
  61.  
  62.  
  63.    call MenuWindow(FASTHOST,FASTPORT,xpos,ypos,width,height)
  64.  
  65.    call AddMenu(FASTHOST,"Tools  ")
  66.     call AddItem(FASTHOST," New WShell     ","'address command newwsh'",W)
  67.      call AddItem(FASTHOST," RExxRun        ","REXX:RExxRun",X)
  68.     call AddItem(FASTHOST," Editors        ","")
  69.          call AddSubItem(FASTHOST,"  Edit E      ","'address command ''sys:tools/e'''",E)
  70.          call AddSubItem(FASTHOST,"  Edit CED    ","'address command ''sys:Tools/CED'''",C)
  71.     call AddItem(FASTHOST," ShowPrint      ","'address command ''runwsh sys:BigC/ShowPrint'''",S)
  72.     call AddItem(FASTHOST," Printer Setup  ","REXX:PrtSetup",U)
  73.     call AddItem(FASTHOST," Printer Select ","REXX:PrtSelect",L)
  74.     call AddItem(FASTHOST," Print File     ","REXX:RExxPrint",P)
  75.     call AddItem(FASTHOST," DiskTools      ","")
  76.         call AddSubItem(FASTHOST," Clean VD0:    ","'address command ''dh0:System/DiskUtils/CleanRamDisk'''",V)
  77.         call AddSubItem(FASTHOST," Clean Memory  ","'address command ''sys:tools/Clean'''")
  78.         call AddSubItem(FASTHOST," NewZap        ","'address command ''sys:System/DiskUtils/Zap'''",Z)
  79.     call AddItem(FASTHOST," GOMF           ","")
  80.         call AddSubItem(FASTHOST,"  Nuke         ","'address command ''sys:System/Nuke'''")
  81.         call AddSubItem(FASTHOST,"  Recall GOMF  ","'address command ''sys:System/Recall'''")
  82.     call AddItem(FASTHOST," Quit Fast Menu ","'address FASTHOST quit'",Q)
  83.  
  84.    call AddMenu(FASTHOST,"DeskTop  ")
  85.      call AddItem(FASTHOST," Card Index     ","'address command ''runwsh dh0:BigC/AmigaDex'''",A)
  86.      call AddItem(FASTHOST," Calendar       ","'pragma(''D'',''dh0:DeskTop/Organizers'');address command ''runwsh dh0:DeskTop/Organizers/Calendar'''",D)
  87.      call AddItem(FASTHOST," Rollodex       ","'pragma(''D'',''dh0:DeskTop/Organizers'');address command ''runwsh dh0:DeskTop/Organizers/Rollodex'''",R)
  88.     call AddItem(FASTHOST," Note Pad       ","'address command ''runwsh dh0:BigC/MemoPad'''",N)
  89.      call AddItem(FASTHOST," Calculators    ","")
  90.          call AddSubItem(FASTHOST,"  Programmer    ","'address command ''runwsh dh0:DeskTop/Calculators/Programmer'''")
  91.          call AddSubItem(FASTHOST,"  Financial     ","'address command ''runwsh dh0:DeskTop/Calculators/Financial'''")
  92.          call AddSubItem(FASTHOST,"  Scientific    ","'address command ''runwsh dh0:DeskTop/Calculators/Scientific'''")
  93.  
  94.    call AddMenu(FASTHOST,"Applications  ")
  95.      call AddItem(FASTHOST," Terminal       ","'pragma(''D'',''Online!:'');address command ''runwsh Online!:Online!'''")
  96.      call AddItem(FASTHOST," Word Processor ","'pragma(''D'',''ProWrite:'');address command ''runwsh ProWrite:Prowrite'''")
  97.      call AddItem(FASTHOST," Spreadsheet    ","'pragma(''D'',''Analyze!:'');address command ''runwsh Analyze!:Analyze!'''")
  98.      call AddItem(FASTHOST," Data Base      ","'pragma(''D'',''Filer:'');address command ''runwsh Filer:FileIIsg'''")
  99.     call AddItem(FASTHOST," Paint          ","'pragma(''D'',''Dpaint:'');address command ''runwsh Dpaint:Dpaint'''")
  100.     call AddItem(FASTHOST," CanDo          ","'pragma(''D'',''Cando:'');address command ''runwsh Cando:Cando'''")
  101.  
  102.    call AddMenu(FASTHOST,"Devices  ")
  103.     call AddItem(FASTHOST," Mounts         ","")
  104.         call AddSubItem(FASTHOST," Add PATH:   ","'address command ''mount PATH:'''")
  105.         call AddSubItem(FASTHOST," Rem PATH:   ","'address command ''assign path: remove'';address command ''assign tao: remove'''",,,SAMELINE)
  106.         call AddSubItem(FASTHOST," MSDos DI0:  ","'address command ''mount DI0: FROM devs:mountlist.msdosfs'''")
  107.         call AddSubItem(FASTHOST," Kill DI0:   ","'address command ''Kill DI0:'''",,,SAMELINE)
  108.         call AddSubItem(FASTHOST," MSDos DI1:  ","'address command ''mount DI1: FROM devs:mountlist.msdosfs'''")
  109.         call AddSubItem(FASTHOST," Kill DI1:   ","'address command ''Kill DI1:'''",,,SAMELINE)
  110.     call AddItem(FASTHOST," Set Paths For: ","")
  111.         call AddSubItem(FASTHOST," LIBS:   ","'address command ''assign LIBS: path:dh0:Libs,dh0:Libs/Bmaps'''")
  112.         call AddSubItem(FASTHOST," C:      ","'address command ''assign C: path:dh0:C,dh0:C/ExtC'''")
  113.         call AddSubItem(FASTHOST," FONTS:  ","'address command ''assign FONTS: path:dh0:Fonts,dh1:BigFonts'''")
  114.     call AddItem(FASTHOST," Kill Paths For:","")
  115.         call AddSubItem(FASTHOST," LIBS:   ","'address command ''assign LIBS: dh0:Libs'''")
  116.         call AddSubItem(FASTHOST," C:      ","'address command ''assign C: dh0:C'''")
  117.         call AddSubItem(FASTHOST," FONTS:  ","'address command ''assign FONTS: dh0:Fonts'''")
  118.  
  119.    call SetNotify(FASTHOST,GADGETUP,FASTHOST)
  120.    call SetNotify(FASTHOST,CLOSEWINDOW,FASTHOST)
  121.    call SetNotify(FASTHOST,MENUPICK,REXX)
  122.  
  123. exit
  124.  
  125. /* MenuWindow.rexx - menu making function */
  126.  
  127. MenuWindow:
  128. arg menuhost, menuport, xpos, ypos, width, height
  129.  
  130. address AREXX  "'x=createhost(" menuhost "," menuport ")'"
  131.  
  132. mp = openport(menuport)
  133. do for 10/(10/50) while ~showlist('p',menuhost)
  134.    call delay 10
  135. end
  136.  
  137. if ~(mp & showlist('p',menuhost)) then
  138.    return
  139.  
  140. idcmp = 'CLOSEWINDOW+MENUPICK'
  141. flags = 'WINDOWDRAG+BORDERLESS+BACKFILL+WINDOWCLOSE'
  142.  
  143. if width = "" | width < 240 then width = 240
  144. if height = "" | height < 10 then height = 10
  145. if xpos ="" then xpos = 150
  146. if ypos ="" then ypos = 0
  147.  
  148. txt_wid = trunc((width-26)/8) + 1
  149. win_text = center('ARexx Menu',txt_wid)
  150.  
  151. call SetReqColor(menuhost,BLOCK,3)
  152.  
  153. /* Open the menu window in the upper left-hand corner */
  154. call OpenWindow(menuhost,xpos,ypos,width,height,idcmp, flags,win_text)
  155.  
  156. return 0
  157.